﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using clBUS;
using System.IO;
using clEntidad;

namespace portero_
{
    public partial class frmVerFoto : Form
    {
        public frmVerFoto()
        {
            InitializeComponent();
        }
        public int idVisita { get; set; }
        private void frmVerFoto_Load(object sender, EventArgs e)
        {

        }

        private void frmVerFoto_Shown(object sender, EventArgs e)
        {
            BUSRegistro objBUS = new BUSRegistro(Constantes.CADENA_BD);
            Registro elem = objBUS.get(idVisita);
            this.Text = elem.persona.nombres + " " + elem.persona.apePat + " " + elem.persona.apeMat;
            if (elem.foto != null)
            {
                MemoryStream ms = new MemoryStream();
                ms.Write(elem.foto, 0, elem.foto.GetUpperBound(0) + 1);
                pictureBox1.Image = System.Drawing.Image.FromStream(ms);
                this.Height = pictureBox1.Image.Height+30;
                this.Width = pictureBox1.Image.Width+30;
                //MessageBox.Show(pictureBox1.Image.Height.ToString());
                ms.Close();
            }
            else
            {
                pictureBox1.Image = null;
            }
        }
    }
}
